//
//  IntroViewController.m
//  QT
//
//  Created by 甘世清 on 2025/1/6.
//

#import "IntroViewController.h"

@interface IntroViewController ()
@property (nonatomic , strong) SQCustomButton *reloadBtn;
@end

@implementation IntroViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.zx_navTitle = SQNSLocalString(@"关于我们");
}

- (void)SQ_UIViewForSelfView{
    UIImageView * image = [[UIImageView alloc]init];
    image.image = SQGetImage(@"logo");
    image.layer.cornerRadius = 12;
    image.layer.masksToBounds = YES;
    image.contentMode = UIViewContentModeScaleAspectFit;
    [self.view addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.view);
            make.size.mas_equalTo(90);
            make.top.equalTo(self.zx_navBar.mas_bottom).offset(100);
    }];
    
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *applocalversion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
 
    
    UILabel * label = [[UILabel alloc]init];
    label.textColor = UIColor.blackColor;
    label.font = FONT_MEDIUM(14);
    label.text = [NSString stringWithFormat:@"Version: %@",applocalversion];
    [self.view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.view);
            make.top.equalTo(image.mas_bottom).offset(20);
    }];
    [self.view addSubview:self.reloadBtn];
    [self.reloadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.height.mas_equalTo(50);
        make.width.mas_equalTo(SCREEN_WIDETH-40);
        make.bottom.equalTo(self.view.mas_bottom).offset(-FootHeight-20);
    }];
    
    [self.reloadBtn setTouchBlock:^(SQCustomButton * _Nonnull button) {
        NSString *str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id6736890354"];
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:^(BOOL success) {
        }];
    }];
    
}

- (SQCustomButton *)reloadBtn{
    if (!_reloadBtn) {
        _reloadBtn = [[SQCustomButton alloc]initType:SQCustomButtonLeftImageType imageSize:CGSizeMake(0, 0) midmargin:0];
        _reloadBtn.text = SQNSLocalString(@"给个好评");
        _reloadBtn.font = FONT_MEDIUM(14);
        _reloadBtn.textColor = SQColor333333;
        _reloadBtn.layer.cornerRadius = 10;
        _reloadBtn.layer.borderColor = SQColor333333.CGColor;
        _reloadBtn.layer.borderWidth = 0.5;
        _reloadBtn.backgroundColor = UIColor.whiteColor;
    }
    return _reloadBtn;
}
@end
